package com.xiangge.lianxi;

import java.util.Scanner;

public class Zhishu {
    public static void main(String[] args) {
        System.out.print("输入一个正整数：");
        int n = new Scanner(System.in).nextInt();
        if (n < 2) {
            System.err.println("输入错误");
            return;
        }
        boolean flag = true;
        for (int i = 2; i <= (n - 1); i++) {
            if (n % i == 0) {
                flag = false;
                break;
            }
        }
        if (flag) {
            System.out.println(n + "是质数");
        } else {
            System.out.println(n + "不是质数");
        }
    }
}
